using System.Linq;
using System.Diagnostics.Contracts;
using System.Collections.Generic;
using System;
using System.Web.Mvc;

namespace ProjectBase.Core
{
    [ContractClass(typeof(Diagnostics.FilterBinder<,>))]
    public interface IFilterBinder<in TFilter, in TID>
        where TFilter : class, IFilter<TID>
    {
        /// <summary>
        ///     Binds data into the filtering object.
        ///     Could be (re)used for UI binding as well as for any other purposes.
        /// </summary>
        /// <param name = "filter"></param>
        /// <param name = "valueProvider"></param>
        /// <param name="prefix">e.g. "Address". Outter entity asks Inner entity Facade for property binding</param>
        /// <param name="includeProperties"></param>
        /// <param name="excludeProperties"></param>
        /// <returns></returns>
        bool BindFilter(TFilter filter
            , IValueProvider valueProvider
            , string prefix = null
            , IEnumerable<string> includeProperties = null
            , IEnumerable<string> excludeProperties = null);
    }
}